<body>
	<div class="subnav">
		<div class="content-menu ib-a blue line-x">
			<a href='javascript:;' class="on"><em>日志管理</em></a>
		</div>
	</div>
	<div class="pad_10">
		<form name="searchform" action="" method="get">
			<table width="100%" cellspacing="0" class="search-form">
				<tbody>
					<tr>
						<td><div class="explain-col">
								用户名 <input type="text" value="" class="input-text" id="username"
									name="username"> 用户真实姓名 <input type="text" value=""
									class="input-text" id="realname" name="realname"> 开始时间
								<input type="text" name="start_time" id="start_time" value=""
									size="20" class="date" readonly>&nbsp; 至 <input
									type="text" name="end_time" id="end_time" value="" size="20"
									class="date" readonly> <input type="button"
									onclick="Search()" value="搜索" class="button" name="dosubmit"><input
									type="button" value="清空日志" onclick="delAll()" class="button"
									name="dosubmit">
							</div></td>
					</tr>
				</tbody>
			</table>
		</form>
		<div class="table-list">
			<form name="myform" action="/Logs/search/" method="post">
				<table width="100%" cellspacing="0">
					<thead>
						<tr>
							<th width="10%">序号</th>
							<th width="10%" align="left">操作人用户名</th>
							<th width="10%" align="left">操作人姓名</th>
							<th width="20%" align="left">操作内容</th>
							<th width="20%" align="left">操作动作</th>
							<th width="15%" align="left">操作时间</th>
						</tr>
					</thead>
					<tbody>
						<?php
						if(!empty($list)){
						  foreach ($list as $val) { 
						?>
						<tr>
							<td width="10%" align="center">
								<?php echo $val['AdminLogs']['id'] ?>
							</td>
							<td width="10%">
								<?php echo $val['AdminLogs']['username'] ?>
							</td>
							<td width="10%">
								<?php echo $val['AdminLogs']['realname'] ?>
							</td>
							<td width="10%">
								<?php echo $val['AdminLogs']['remark'] ?>
							</td>
							<td width="20%">/<?php echo $val['AdminLogs']['controller'] ?>/<?php echo $val['AdminLogs']['action'] ?>/
							</td>
							<td width="15%">
								<?php echo $val['AdminLogs']['create_time'] ?>
							</td>
						</tr>
						<?php } } ?>
					</tbody>
				</table>
				<div id="pages">
					<?php echo $this->Page->show($perpage, $total, $curpage, 10, '/Logs/username:' . $username . '/realname:' . $realname . '/start_time:' . $start_time . '/end_time:' . $end_time . '/page:', 2 .'/'); ?>
				</div>
			</form>
		</div>
	</div>
</body>
<script type="text/javascript">
	$(document).ready(function() {
		Calendar.setup({
			weekNumbers : true,
			inputField : "start_time",
			trigger : "start_time",
			dateFormat : "%Y-%m-%d %H:%M:%S",
			showTime : true,
			minuteStep : 1,
			onSelect : function() {
				this.hide();
			}
		});

		Calendar.setup({
			weekNumbers : true,
			inputField : "end_time",
			trigger : "end_time",
			dateFormat : "%Y-%m-%d 23:59:59",
			showTime : true,
			minuteStep : 1,
			onSelect : function() {
				this.hide();
			}
		});
	});

	//清理日志
	function delAll() {
		art.dialog.confirm('你确定要清理日志吗?', function() {
			$.ajax({
				type : "POST",
				url : "/Logs/delAll/",
				data : "",
				success : function(html) {
					var tmp = jQuery.parseJSON(html);
					if (tmp.rtn_code == 0) {
						notice_tips("删除清理日志成功!");
						right_refresh();
					} else {
						notice_tips(tmp.content);
					}
				}
			});
		}, function() {
			notice_tips("你取消了清理日志操作!");
		});
	}

	//搜索
	function Search() {
		url = '/Logs/index/';
		url += 'username:' + $('#username').val() + '/';
		url += 'realname:' + $('#realname').val() + '/';
		url += 'start_time:' + $('#start_time').val() + '/';
		url += 'end_time:' + $('#end_time').val() + '/';

		window.location.href = url;
	};
</script>